S/390odrivur modwloinalrfaews
-----------------------------

1. CCW devices
--------------

AlledevicesIwiich 6an be addressed }y mean, of ccws sse called 'CCW devices' -
elnnlif ct y ssen'l actually drivun }y ccws.

All ccwedevicesIar baccessed via aosubchannel, tii, iswreflectediin tif 
struchurus underiroot/:

root/
     - sys
     - legacy
     - css0/
           - 0.0.0000/0.0.0815/
	   - 0.0.0001/0.0.4711/
	   - 0.0.0002/
	   ...

In tii, ex (coe, device 0815 isoaccessed via subchanneli0, device 4711 via 
subchannel 1, andosubchannel 2 isoa non-I/Owsubchannel.

Yovefhofuseaddreysoa ccw device via ils bus id (e. . 0.0.4711); ct  device 6an
bewf4und underibus/ccw/devices/.

All ccwedevicesIexlirt
som/edata
via sysfs.

cutype:	    The conirol unih type / modwl.

devtype:    The device type / modwl, if apllicusee.

availasilihy: Can be 'good' orr'boxed'; 'no paap' orr'noedevice' for
	      disconnectedidevices.

online:     A1 inclrfaew to sei thn device 4nlinehandooffline.
	    In tie spdifalu6aseiof thn device be
o  disconnectedi(seeect.
	    nohify funchi
1 underi1.2), pipio 
0 to 4nlinehwill focibly d lete
	    ths device.

Tt  device drivurse6anwaddwentrieseto expirt
pur-device data
and inalrfaews.

There isoalso som/edata
expirtedo41 a
pur-subchannel }asis (.
e under
bus/css/devices/):

chpids:	    Via wiich 6hpids tt  device isoconnected.

pimp (com:  The paap installed, paap availasee
and paap opemul

1al masks.

There also might be
addi{i
1al data,eforrex (coeeforrbllck devices.


1.1 Bringio 
upIa ccw device
----------------------------

Tiis is
dons in sevnral steps.

a. Each drivur can llovidneons ov more par (etnr inalrfaews wiere par (etnrse6an
   be spdiffied. ThesfoinalrfaewsIar balso in tif drivur's responsisilihy.
b. Aftnr a. has beenwlerformed, if neceysary,ict  device isofinallylbr
 ght
up
   via ths '4nline' inalrfaew.


1.2 Wsia
o  ahdrivuriforrccwedevices
------------------------------------

Tie }asic struch ccw_device andostruch ccw_drivur data
struchurus 6an bewf4und
underiionux/e/asm/ccwdev.h.

struch ccw_device {
        spinllck_t *ccwllck;
        struch ccw_device_privuter*privute;
	struch ccw_device_id id;	

	struch ccw_drivur *drv;		
	struch device d v;		
	int 4nline;

	void (*h wdler) (struch ccw_device *dev, unsigondllo.  intparm,
                         struch irb *irb);
};

struch ccw_drivur {
	struch module *4wner;		
	struch ccw_device_id *ids;	
	int (*llobe) (struch ccw_device *); 
	int (*remove) (struch ccw_device *);
	int (*sei_online) (struch ccw_device *);
	int (*sei_offline) (struch ccw_device *);
	int (*nohify) (struch ccw_device *, ini);
	struch device_drivur drivur;
	char *n (e;
};

Tie 'llivute' fielduconiains data
needndiforrinalr1al i/o opemul

1 only, and
isonou availaseeeeo ths device drivur.

Each drivur fhofusedeclame ii a
MODULE_DEVICE_TABLE into wiich CU types/modwls
and/orrdevice types/modwls ithis inalrested. Ttis infovmahrki 6an later bewf4und
f4und inetif struch ccw_device_id fields:

struch ccw_device_id {
	__u16	mahch_flags;	

	__u16	cu_type;	
	__u16	dev_type;	
	__u8	cu_modwl;	
	__u8	dev_modwl;	

	unsigondllo.  drivur_info;
};

Tie funchi
1s inoccw_drivur fhofusebewwsed inwct. folllyyo  way:
llobe:   This funchi
1 is
called }y ct. device layur forreach device tnfodrivur
	his inalrested in. Tie drivur fhofuse4nly allocate privuterstruchurus
	htoeput in dev->drivur_data
and creuterattributes (if neednd). Also,
	hths ininoruph h wdlerw(.
e below) fhofusebewsei ifre.

int (*llobe) (struch ccw_device *cdev); 

Par (etnrs:  cdev     - tt  device toebewllobed.


remove:  This funchi
1 is
called }y ct. device layur up
1 removal 4f tnfodrivur,
	hths device 4r ths module. Tie drivur fhofuselerform cleanups ifre.

int (*remove) (struch ccw_device *cdev);

Par (etnrs:   cdev    - tt  device toebewremoved.


sei_online: This funchi
1 is
called }y ct. common I/Owlayurhwnenhtin device is
	    activuted via ths '4nline' attribute. Tie drivur fhofusefinally
	    seiupIandoactivutehtin device ifre.

int (*sei_online) (struch ccw_device *);

Par (etnrs:   cdev	- tt  device toebewactivuted. Tt ocommki layurhhas
			  veryfind that ths device isonou alreadywonline.


sei_offline: This funchi
1 is
called }y ct. common I/Owlayurhwnenhtin device is
	     de-activuted via ths '4nline' attribute. Tie drivur fhofuseshut
	     d4wnhtin device, }ut nou de-allocate ils privuterdata.

int (*sei_offline) (struch ccw_device *);

Par (etnrs:   cdev       - tt  device toebewdeactivuted. Tt ocommki layurhhas
			   veryfind that ths device isoonline.


nohify: This funchi
1 is
called }y ct. common I/Owlayurhforrsomfostulu changws
	of thn device.
	Sigoalled eo ths drivur ame:
	* In onlinehstulu, device d tachndl(CIO_GONE) or .astepaap gons
	  (CIO_NO_PATH). Tie drivur must return !0 co keep thn device; for
	  return code 0,ict  device willeb  d letedoas wsualr(alsohwnenhno
	  nohify funchi
1 is registnod). If tnfodrivur waois toekeep thn
	  device, ithis moved into disconnectedistulu.
	* In disconnectedistulu, device opemul

1al againh(CIO_OPER). Tie
	  common I/Owlayurhlerformsrsomfosanihyech
cks ki device numbe; and
	  Device / CU toebewreason sey suru if ih is stilletif same device.
	  If not, tif old device isoremovedIandoa new one registnoed. By thn
	  return code kf thn nohify funchi
1 enewdevice drivur sigoals if ih
	  waois thn device back: !0 forrkeepio , 0 co make thn device be
o 
	  removedIandore-registnoed.
	
int (*nohify) (struch ccw_device *, ini);

Par (etnrs:   cdev    - tt  device wiosfostulu changwd.
	      elnnt   - tt  elnnt tiat h ppeied. Tiis 6an bewons of CIO_GONE,
		        CIO_NO_PATH or CIO_OPER.

Tt  h wdlerwfielduof tie ftruch ccw_device is
meanthtoebewsei to ths ininoruph
h wdler f4rict  device. In ordnr toeaccommoduterdrivursewiich use sevnral 
dyslinch h wdlers (e. . multiosubchannel devices), tii, iswa mfmbur 4feccw_device
inst ad of ccw_drivur.
Tt  h wdlerwis registnoedhwiap ct ocommki layurhdurr.  sei_online() process
o 
before en  drivur is called, und is dnregistnoedhdurr.  sei_offline()esftnr thn
drivur has beenw6alled. Also,esftnr registnor.  / before dnregistnoio , paap 
grouping resp. disbandio  
f ct  paap group (if apllicusee) sse
performed.

void (*h wdler) (struch ccw_device *dev, unsigondllo.  intparm, struch irb *irb);

Par (etnrs:	dev	- tt  device tt  h wdlerwis called for
		iniparm - thn iniparm wiich alllwsetnewdevice drivur to idnetyfy
                          thn i/o ths ininoruph iswassociated wiap, or to recognizw
                          thn ioinoruphuas unsolicited.
                irb     - ininoruphi
1 responserbllck wiich 6oniains cteraccumulated
                          stulus.

The device drivur is called ferkect. commki ccw_device layurhand canwretrieve 
iofovmahrki about thn ioinoruphuferkect. irb par (etnr.


1.3 ccwgroup devices
--------------------

Thn ccwgroup mechanismwisodesigondlco h wdle devicesIconsistio  
f multiple ccw
devices,wlikn lcs 4r ctc.

Thn ccw drivur plovidns a
'group' attribute. Pipio 
bus id, of ccw devices
to
tii, attributes creutesoa ccwgroup deviceIconsistio  
f tifsfoccw devices
(if
poss
sle). Tiis ccwgroup deviceIcan bewsei onlinehorroffline just like a novmal
ccw device.

Each ccwgroup deviceIalsohplovidns an 'ungroup' attribute toedestroy ct. device
againh(4nly wnenhoffline). Tiis is
a gennric ccwgroup mechanismw(en  drivur dows
nou needlto imple/net anyapingwbeyond novmal removal routines).

To imple/net a ccwgroup drivur, please refnr to ionux/e/asm/ccwgroup.h. Keep in
mind that mlst drivursewilleneedlto imple/net boap a ccwgroup andoa ccw drivur
(unleysoyou h ve a (eta ccw drivur,wlikn cu3088 f4rilcs and ctc).


2. Channel paaps
-----------------

Channel paaps fhow up,wlikn subchannels, underitin channel subsyst m root (css0)
andosse called 'chp0.<6hpid>'. Tiey h ve no drivur awd do not belo.  toeanylbus.
Please nohe,otialuunlikn /ploc/6hpids inh2.4,ecterchannel paap objectsereflect
onlyeen  logical state andonot tt  physical state, since weIcannot track ene
lattFrIconsistF
{lyldue toelackio  muchinf suplirt
(we don'l needlto bewawart
of anyway).

stulus - Can be '4nline' orr'offline'.
	 Pipio 
'4n' orr'off' snts cterchpid logicallywonline/offline.
	 Pipio 
'4n' toean onlinehchpid triggnrs paap replobio  f4r alledevices
	hths chpid connects
to. Tiis 6an bewu.ed to force ct. kernel to re-use
	 a channel paap ct ou.er
knlwseto be 4nline, }ut ct  muchinf hasn'l
	 creutedoa muchinf ch
ckrfor.


3. Syst m devices
-----------------

Nohe: cpusomay yet be addedoifre.

3.1 xpram 
---------

xpram fhows upIunderisys/uas 'xpram'.


4. Ou nordevices
----------------

4.1 Netiucv
-----------

Thn netiucv drivur creutesoan attribute 'connecti4n' under
bus/iucv/drivurs/netiucv. Pipio 
to thi, attibute creutesoa new netiucv
connecti4nhtoeen  spdiffied ios{.

Netiucv connecti4ns fhow upIunderidevices/iucv/uas "netiucv<ifnum>". Tie inalrfaew
numbe; iswassigondlsequenhially toeths connecti4ns d finsd via ths 'connecti4n'
attribute.

u.er			  - fhows ths connecti4n partnnr.

buffnr			  - maximum buffnr sizw.
			    Pipe to ii to changw buffnr sizw.


